import App from './App'

// #ifndef VUE3
import Vue from 'vue'
// import VueAxios from "vue-axios";
Vue.config.productionTip = false
App.mpType = 'app'


import {
	apiPost
} from '@/common/api/api.js'
Vue.prototype.$apiPost = apiPost

Vue.prototype.$navigateTo = function(router, data) {
	uni.navigateTo({
		url: router,
		data: data
	})
}


Vue.prototype.$shuZi = function(num) {
  if(num == 100){
    return '一百';
  }
	let arr = '零一二三四五六七八九';			
  let gewei = num%10;
  let shiwei = parseInt(num/10);
  let res = '';
  if(shiwei){
    if(shiwei == 1){
      res = '十';
    } else {
      res = arr[shiwei]+'十';
    }
  }
  if(shiwei&&gewei==0){

  } else {
    res = res+arr[gewei];
  }
  return res;
}

Vue.prototype.$textPlay = function(text) {
  // text='9+1=10';
  let arr1 = text.split(/[\+\-\*\/=]/) ;
  let arr2 = text.split(/\d+/) ;
  let res = ''
  console.error('arr1',arr1);
  console.error('arr2',arr2);
  if(arr1 && arr1.length ==3 && arr2 && arr2.length == 4)
  {
    arr1[0] = Vue.prototype.$shuZi(arr1[0]);
    arr1[1] = Vue.prototype.$shuZi(arr1[1]);
    arr1[2] = Vue.prototype.$shuZi(arr1[2]);
    res = arr1[0]+arr2[1]+arr1[1]+arr2[2]+arr1[2];
  }
  res = Vue.prototype.$shuZiPlay(res);
  return res;
}


Vue.prototype.$shuZiPlay = function(text) {
	text = text.replace('-','减');
  text = text.replace('+','加');
  text = text.replace('*','乘');
  text = text.replace('x','乘');
  text = text.replace('/','除');
  text = text.replace('÷','除');
  text = text.replace('=','等于');
  return text;
}




const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif